package com.yenlien.traceyun.usercenter.dao;

import com.yenlien.traceyun.usercenter.entity.UserResource;
import com.yenlien.traceyun.webase.dao.BaseJpaDao;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @author: bigwangy@sina.com
 * @create: 2020-06-05
 * @description:
 **/
public interface UserResourceDao extends BaseJpaDao<UserResource> {

    @Modifying
    @Query("delete from UserResource ur where ur.resourceId in(?1)")
    public void deleteByResourceId(List<String> resourceIds);

    @Modifying
    @Query("delete from UserResource ur where ur.resourceId=?1")
    public void deleteByResourceId(String resourceId);

    public void deleteByUserId(String userId);

    public List<UserResource> findByUserIdAndAppId(String userId, String appId);
}
